import { createApp } from 'vue'
import App from './App.vue'
import router from './router'

import './assets/css/main.css'
import './router/permission'

// 通用字体
import 'vfonts/Lato.css'
// 等宽字体
import 'vfonts/FiraCode.css'

// svgIcon
import './components/SvgIcon/index'

/* pinia */
import pinia from './stores'

import lodash from 'lodash'
import moment from 'moment'

import {createDiscreteApi} from 'naive-ui'

const { message, notification, dialog, loadingBar } = createDiscreteApi(
  ['message', 'dialog', 'notification', 'loadingBar']
)
window.$message = message;
window.$notification = notification;
window.$dialog = dialog;
window.$loadingBar = loadingBar;

const app = createApp(App)
app.config.globalProperties.$lodash = lodash
app.config.globalProperties.$moment = moment
// 文件地址
app.config.globalProperties.$fileUpload = `${import.meta.env.VITE_BASE_URL}/file/upload`
app.config.globalProperties.$fileDownload = `${import.meta.env.VITE_BASE_URL}/file/download?id=`

// 自定义组件注册
declare module 'vue' {
  export interface ComponentCustomProperties {
    $lodash: typeof lodash,
    $moment: typeof moment,
    $fileUpload: string,
    $fileDownload: string,
  }
}

app.use(router)
app.use(pinia)

app.mount('#app')
